home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / humanbio.bst (.txt) < prev    next >
LaTeX Document  |  1992-07-19  |  24KB  |  906 lines

  1. %%% ====================================================================
  2. %%%  @BibTeX-style-file{
  3. %%%     author          = "Alan Rogers",
  4. %%%     version         = "1.1",
  5. %%%     date            = "1990",
  6. %%%     filename        = "humanbio.bst",
  7. %%%     address         = "Dept of Anthropology, University of Utah,
  8. %%%                        Salt Lake City, UT 84112",
  9. %%%     checksum        = "32432 1134 3172 23669",
  10. %%%     email           = "rogers@anthro.utah.edu",
  11. %%%     supported       = "no",
  12. %%%     docstring       = "The file produces bibliographies more or
  13. %%%                        less in the format of the journal Human
  14. %%%                        Biology.  It was adapted from apalike.bst,
  15. %%%                        incorporating features of Sake J.
  16. %%%                        Hogeveen's `astron.bst'.
  17. %%%                        Usage: \documentstyle[astron]{...}
  18. %%%                        ...
  19. %%%                        \bibliographystyle{humanbio}
  20. %%%                        ...
  21. %%%                        The \documentstyle command above invokes
  22. %%%                        Hogeveen's `astron.sty', which must be in
  23. %%%                        TeX's search path.
  24. %%%                        The modifications implement `\cite*{}',
  25. %%%                        which generates references in short form.
  26. %%%                        For example, `Rogers \cite*{...}' would
  27. %%%                        produce `Rogers (1992)'."
  28. %%%  }
  29. %%% ====================================================================
  30. %%%%%%%%%%
  31. % BibTeX `apalike' bibliography style (24-Jan-88 version)
  32. % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
  33. % Copyright (C) 1988, all rights reserved.
  34. % Copying of this file is allowed, provided that if you make any changes at all
  35. % you name it something other than `apalike.bst'.
  36. % This restriction helps ensure that all copies are identical.
  37. % Differences between this style and `alpha' are generally heralded by a `%'.
  38. % The file btxbst.doc has the documentation for alpha.bst.
  39. % This style should be used with the `apalike' LaTeX style (apalike.sty).
  40. % \cite's come out like "(Jones, 1986)" in the text but there are no labels
  41. % in the bibliography, and something like "(1986)" comes out immediately
  42. % after the author.  Author (and editor) names appear as last name, comma,
  43. % initials.  A `year' field is required for every entry, and so is either
  44. % an author (or in some cases, an editor) field or a key field.
  45. % Editorial note:
  46. % Many journals require a style like `apalike', but I strongly, strongly,
  47. % strongly recommend that you not use it if you have a choice---use something
  48. % like `plain' instead.  Mary-Claire van Leunen (A Handbook for Scholars,
  49. % Knopf, 1979) argues convincingly that a style like `plain' encourages better
  50. % writing than one like `apalike'.  Furthermore the strongest arguments for
  51. % using an author-date style like `apalike'---that it's "the most practical"
  52. % (The Chicago Manual of Style, University of Chicago Press, thirteenth
  53. % edition, 1982, pages 400--401)---fall flat on their face with the new
  54. % computer-typesetting technology.  For instance page 401 anachronistically
  55. % states "The chief disadvantage of [a style like `plain'] is that additions
  56. % or deletions cannot be made after the manuscript is typed without changing
  57. % numbers in both text references and list."  LaTeX sidesteps the disadvantage.
  58. % History:
  59. %   15-sep-86    (SK,OP)    Original version, by Susan King and Oren Patashnik.
  60. %   10-nov-86    (OP)    Truncated the sort.key$ string to the correct length
  61. %            in bib.sort.order to eliminate error message.
  62. %   24-jan-88    (OP)    Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
  63. %            apalike now sorts by author, then year, then title;
  64. %            THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  65. ENTRY
  66.   { address
  67.     author
  68.     booktitle
  69.     chapter
  70.     edition
  71.     editor
  72.     howpublished
  73.     institution
  74.     journal
  75.     key
  76. %    month        not used in apalike
  77.     note
  78.     number
  79.     organization
  80.     pages
  81.     publisher
  82.     school
  83.     series
  84.     title
  85.     type
  86.     volume
  87.     year
  88.   { label extra.label sort.label }
  89. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  90. FUNCTION {init.state.consts}
  91. { #0 'before.all :=
  92.   #1 'mid.sentence :=
  93.   #2 'after.sentence :=
  94.   #3 'after.block :=
  95. STRINGS { s t }
  96. FUNCTION {output.nonnull}
  97. { 's :=
  98.   output.state mid.sentence =
  99.     { ", " * write$ }
  100.     { output.state after.block =
  101.     { add.period$ write$
  102.       newline$
  103.       "\newblock " write$
  104.     { output.state before.all =
  105.         'write$
  106.         { add.period$ " " * write$ }
  107.       if$
  108.       if$
  109.       mid.sentence 'output.state :=
  110.     }
  111.   if$
  112. FUNCTION {output}
  113. { duplicate$ empty$
  114.     'pop$
  115.     'output.nonnull
  116.   if$
  117. FUNCTION {output.check}
  118. { 't :=
  119.   duplicate$ empty$
  120.     { pop$ "empty " t * " in " * cite$ * warning$ }
  121.     'output.nonnull
  122.   if$
  123. %                    apalike needs this function because
  124. %                    the year has special punctuation;
  125. %                    apalike ignores the month
  126. FUNCTION {output.year.check}
  127. { year empty$
  128.     { "empty year in " cite$ * warning$ }
  129.     { write$
  130.       " " year * extra.label * "" *
  131.       mid.sentence 'output.state :=
  132.     }
  133.   if$
  134. FUNCTION {output.bibitem}
  135. { newline$
  136.   "\bibitem[" write$
  137.   label write$
  138.   "]{" write$
  139.   cite$ write$
  140.   "}" write$
  141.   newline$
  142.   before.all 'output.state :=
  143. FUNCTION {fin.entry}
  144. { add.period$
  145.   write$
  146.   newline$
  147. FUNCTION {new.block}
  148. { output.state before.all =
  149.     'skip$
  150.     { after.block 'output.state := }
  151.   if$
  152. FUNCTION {new.sentence}
  153. { output.state after.block =
  154.     'skip$
  155.     { output.state before.all =
  156.     'skip$
  157.     { after.sentence 'output.state := }
  158.       if$
  159.     }
  160.   if$
  161. FUNCTION {not}
  162. {   { #0 }
  163.     { #1 }
  164.   if$
  165. FUNCTION {and}
  166. {   'skip$
  167.     { pop$ #0 }
  168.   if$
  169. FUNCTION {or}
  170. {   { pop$ #1 }
  171.     'skip$
  172.   if$
  173. FUNCTION {new.block.checkb}
  174. { empty$
  175.   swap$ empty$
  176.   and
  177.     'skip$
  178.     'new.block
  179.   if$
  180. FUNCTION {field.or.null}
  181. { duplicate$ empty$
  182.     { pop$ "" }
  183.     'skip$
  184.   if$
  185. FUNCTION {emphasize}
  186. { duplicate$ empty$
  187.     { pop$ "" }
  188.     { "{\em " swap$ * "}" * }
  189.   if$
  190. INTEGERS { nameptr namesleft numnames }
  191. FUNCTION {format.names}
  192. { 's :=
  193.   #1 'nameptr :=
  194.   s num.names$ 'numnames :=
  195.   numnames 'namesleft :=
  196.     { namesleft #0 > }
  197.     { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=   % last name first
  198.       nameptr #1 >
  199.     { namesleft #1 >
  200.         { ", " * t * }
  201.         { numnames #2 >
  202.         { "," * }
  203.         'skip$
  204.           if$
  205.           t "others" =
  206.         { " et~al." * }
  207.         { " and " * t * }
  208.           if$
  209.         }
  210.       if$
  211.       if$
  212.       nameptr #1 + 'nameptr :=
  213.       namesleft #1 - 'namesleft :=
  214.     }
  215.   while$
  216. FUNCTION {format.authors}
  217. { author empty$
  218.     { "" }
  219.     { author format.names }
  220.   if$
  221. FUNCTION {format.key}            % this function is just for apalike
  222. { empty$
  223.     { key field.or.null }
  224.     { "" }
  225.   if$
  226. FUNCTION {format.editors}
  227. { editor empty$
  228.     { "" }
  229.     { editor format.names
  230.       editor num.names$ #1 >
  231.     { ", editors" * }
  232.     { ", editor" * }
  233.       if$
  234.     }
  235.   if$
  236. FUNCTION {format.title}
  237. { title empty$
  238.     { "" }
  239.     { title "t" change.case$ }
  240.   if$
  241. FUNCTION {n.dashify}
  242. { 't :=
  243.     { t empty$ not }
  244.     { t #1 #1 substring$ "-" =
  245.     { t #1 #2 substring$ "--" = not
  246.         { "--" *
  247.           t #2 global.max$ substring$ 't :=
  248.         }
  249.         {   { t #1 #1 substring$ "-" = }
  250.         { "-" *
  251.           t #2 global.max$ substring$ 't :=
  252.           while$
  253.         }
  254.       if$
  255.     { t #1 #1 substring$ *
  256.       t #2 global.max$ substring$ 't :=
  257.       if$
  258.     }
  259.   while$
  260. FUNCTION {format.btitle}
  261. { title emphasize
  262. FUNCTION {tie.or.space.connect}
  263. { duplicate$ text.length$ #3 <
  264.     { "~" }
  265.     { " " }
  266.   if$
  267.   swap$ * *
  268. FUNCTION {either.or.check}
  269. { empty$
  270.     'pop$
  271.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  272.   if$
  273. FUNCTION {format.bvolume}
  274. { volume empty$
  275.     { "" }
  276.     { "volume" volume tie.or.space.connect
  277.       series empty$
  278.     'skip$
  279.     { " of " * series emphasize * }
  280.       if$
  281.       "volume and number" number either.or.check
  282.     }
  283.   if$
  284. FUNCTION {format.number.series}
  285. { volume empty$
  286.     { number empty$
  287.     { series field.or.null }
  288.     { output.state mid.sentence =
  289.         { "number" }
  290.         { "Number" }
  291.       if$
  292.       number tie.or.space.connect
  293.       series empty$
  294.         { "there's a number but no series in " cite$ * warning$ }
  295.         { " in " * series * }
  296.       if$
  297.       if$
  298.     }
  299.     { "" }
  300.   if$
  301. FUNCTION {format.edition}
  302. { edition empty$
  303.     { "" }
  304.     { output.state mid.sentence =
  305.     { edition "l" change.case$ " edition" * }
  306.     { edition "t" change.case$ " edition" * }
  307.       if$
  308.     }
  309.   if$
  310. INTEGERS { multiresult }
  311. FUNCTION {multi.page.check}
  312. { 't :=
  313.   #0 'multiresult :=
  314.     { multiresult not
  315.       t empty$ not
  316.       and
  317.     }
  318.     { t #1 #1 substring$
  319.       duplicate$ "-" =
  320.       swap$ duplicate$ "," =
  321.       swap$ "+" =
  322.       or or
  323.     { #1 'multiresult := }
  324.     { t #2 global.max$ substring$ 't := }
  325.       if$
  326.     }
  327.   while$
  328.   multiresult
  329. FUNCTION {format.pages}
  330. { pages empty$
  331.     { "" }
  332.     { pages multi.page.check
  333.     { "pages" pages n.dashify tie.or.space.connect }
  334.     { "page" pages tie.or.space.connect }
  335.       if$
  336.     }
  337.   if$
  338. FUNCTION {format.vol.num.pages}
  339. { volume field.or.null
  340.   number empty$
  341.     'skip$
  342.     { "(" number * ")" * *
  343.       volume empty$
  344.     { "there's a number but no volume in " cite$ * warning$ }
  345.     'skip$
  346.       if$
  347.     }
  348.   if$
  349.   pages empty$
  350.     'skip$
  351.     { duplicate$ empty$
  352.     { pop$ format.pages }
  353.     { ":" * pages n.dashify * }
  354.       if$
  355.     }
  356.   if$
  357. FUNCTION {format.chapter.pages}
  358. { chapter empty$
  359.     'format.pages
  360.     { type empty$
  361.     { "chapter" }
  362.     { type "l" change.case$ }
  363.       if$
  364.       chapter tie.or.space.connect
  365.       pages empty$
  366.     'skip$
  367.     { ", " * format.pages * }
  368.       if$
  369.     }
  370.   if$
  371. FUNCTION {format.in.ed.booktitle}
  372. { booktitle empty$
  373.     { "" }
  374.     { editor empty$
  375.     { "In " booktitle emphasize * }
  376.     { "In " format.editors * ", " * booktitle emphasize * }
  377.       if$
  378.     }
  379.   if$
  380. FUNCTION {format.thesis.type}
  381. { type empty$
  382.     'skip$
  383.     { pop$
  384.       type "t" change.case$
  385.     }
  386.   if$
  387. FUNCTION {format.tr.number}
  388. { type empty$
  389.     { "Technical Report" }
  390.     'type
  391.   if$
  392.   number empty$
  393.     { "t" change.case$ }
  394.     { number tie.or.space.connect }
  395.   if$
  396. FUNCTION {format.article.crossref}
  397. { "In"                            % this is for apalike
  398.   " \cite{" * crossref * "}" *
  399. FUNCTION {format.book.crossref}
  400. { volume empty$
  401.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  402.       "In "
  403.     }
  404.     { "Volume" volume tie.or.space.connect
  405.       " of " *
  406.     }
  407.   if$
  408.   "\cite{" * crossref * "}" *                % this is for apalike
  409. FUNCTION {format.incoll.inproc.crossref}
  410. { "In"                            % this is for apalike
  411.   " \cite{" * crossref * "}" *
  412. FUNCTION {article}
  413. { output.bibitem
  414.   format.authors "author" output.check
  415.   author format.key output                % special for
  416.   output.year.check                    % apalike
  417.   new.block
  418.   format.title "title" output.check
  419.   new.block
  420.   crossref missing$
  421.     { journal emphasize "journal" output.check
  422.       format.vol.num.pages output
  423.     }
  424.     { format.article.crossref output.nonnull
  425.       format.pages output
  426.     }
  427.   if$
  428.   new.block
  429.   note output
  430.   fin.entry
  431. FUNCTION {book}
  432. { output.bibitem
  433.   author empty$
  434.     { format.editors "author and editor" output.check
  435.       editor format.key output
  436.     }
  437.     { format.authors output.nonnull
  438.       crossref missing$
  439.     { "author and editor" editor either.or.check }
  440.     'skip$
  441.       if$
  442.     }
  443.   if$
  444.   output.year.check                % special for apalike
  445.   new.block
  446.   format.btitle "title" output.check
  447.   crossref missing$
  448.     { format.bvolume output
  449.       new.block
  450.       format.number.series output
  451.       new.sentence
  452.       publisher "publisher" output.check
  453.       address output
  454.     }
  455.     { new.block
  456.       format.book.crossref output.nonnull
  457.     }
  458.   if$
  459.   format.edition output
  460.   new.block
  461.   note output
  462.   fin.entry
  463. FUNCTION {booklet}
  464. { output.bibitem
  465.   format.authors output
  466.   author format.key output                % special for
  467.   output.year.check                    % apalike
  468.   new.block
  469.   format.title "title" output.check
  470.   new.block
  471.   howpublished output
  472.   address output
  473.   new.block
  474.   note output
  475.   fin.entry
  476. FUNCTION {inbook}
  477. { output.bibitem
  478.   author empty$
  479.     { format.editors "author and editor" output.check
  480.       editor format.key output
  481.     }
  482.     { format.authors output.nonnull
  483.       crossref missing$
  484.     { "author and editor" editor either.or.check }
  485.     'skip$
  486.       if$
  487.     }
  488.   if$
  489.   output.year.check                % special for apalike
  490.   new.block
  491.   format.btitle "title" output.check
  492.   crossref missing$
  493.     { format.bvolume output
  494.       format.chapter.pages "chapter and pages" output.check
  495.       new.block
  496.       format.number.series output
  497.       new.sentence
  498.       publisher "publisher" output.check
  499.       address output
  500.     }
  501.     { format.chapter.pages "chapter and pages" output.check
  502.       new.block
  503.       format.book.crossref output.nonnull
  504.     }
  505.   if$
  506.   format.edition output
  507.   new.block
  508.   note output
  509.   fin.entry
  510. FUNCTION {incollection}
  511. { output.bibitem
  512.   format.authors "author" output.check
  513.   author format.key output                % special for
  514.   output.year.check                    % apalike
  515.   new.block
  516.   format.title "title" output.check
  517.   new.block
  518.   crossref missing$
  519.     { format.in.ed.booktitle "booktitle" output.check
  520.       format.bvolume output
  521.       format.number.series output
  522.       format.chapter.pages output
  523.       new.sentence
  524.       publisher "publisher" output.check
  525.       address output
  526.       format.edition output
  527.     }
  528.     { format.incoll.inproc.crossref output.nonnull
  529.       format.chapter.pages output
  530.     }
  531.   if$
  532.   new.block
  533.   note output
  534.   fin.entry
  535. FUNCTION {inproceedings}
  536. { output.bibitem
  537.   format.authors "author" output.check
  538.   author format.key output                % special for
  539.   output.year.check                    % apalike
  540.   new.block
  541.   format.title "title" output.check
  542.   new.block
  543.   crossref missing$
  544.     { format.in.ed.booktitle "booktitle" output.check
  545.       format.bvolume output
  546.       format.number.series output
  547.       format.pages output
  548.       address output                    % for apalike
  549.       new.sentence                    % there's no year
  550.       organization output                % here so things
  551.       publisher output                    % are simpler
  552.     }
  553.     { format.incoll.inproc.crossref output.nonnull
  554.       format.pages output
  555.     }
  556.   if$
  557.   new.block
  558.   note output
  559.   fin.entry
  560. FUNCTION {conference} { inproceedings }
  561. FUNCTION {manual}
  562. { output.bibitem
  563.   format.authors output
  564.   author format.key output                % special for
  565.   output.year.check                    % apalike
  566.   new.block
  567.   format.btitle "title" output.check
  568.   organization address new.block.checkb
  569.   organization output
  570.   address output
  571.   format.edition output
  572.   new.block
  573.   note output
  574.   fin.entry
  575. FUNCTION {mastersthesis}
  576. { output.bibitem
  577.   format.authors "author" output.check
  578.   author format.key output                % special for
  579.   output.year.check                    % apalike
  580.   new.block
  581.   format.title "title" output.check
  582.   new.block
  583.   "Master's thesis" format.thesis.type output.nonnull
  584.   school "school" output.check
  585.   address output
  586.   new.block
  587.   note output
  588.   fin.entry
  589. FUNCTION {misc}
  590. { output.bibitem
  591.   format.authors output
  592.   author format.key output                % special for
  593.   output.year.check                    % apalike
  594.   new.block
  595.   format.title output
  596.   new.block
  597.   howpublished output
  598.   new.block
  599.   note output
  600.   fin.entry
  601. FUNCTION {phdthesis}
  602. { output.bibitem
  603.   format.authors "author" output.check
  604.   author format.key output                % special for
  605.   output.year.check                    % apalike
  606.   new.block
  607.   format.btitle "title" output.check
  608.   new.block
  609.   "PhD thesis" format.thesis.type output.nonnull
  610.   school "school" output.check
  611.   address output
  612.   new.block
  613.   note output
  614.   fin.entry
  615. FUNCTION {proceedings}
  616. { output.bibitem
  617.   format.editors output
  618.   editor format.key output                % special for
  619.   output.year.check                    % apalike
  620.   new.block
  621.   format.btitle "title" output.check
  622.   format.bvolume output
  623.   format.number.series output
  624.   address output                % for apalike
  625.   new.sentence                    % we always output
  626.   organization output                % a nonempty organization
  627.   publisher output                % here
  628.   new.block
  629.   note output
  630.   fin.entry
  631. FUNCTION {techreport}
  632. { output.bibitem
  633.   format.authors "author" output.check
  634.   author format.key output                % special for
  635.   output.year.check                    % apalike
  636.   new.block
  637.   format.title "title" output.check
  638.   new.block
  639.   format.tr.number output.nonnull
  640.   institution "institution" output.check
  641.   address output
  642.   new.block
  643.   note output
  644.   fin.entry
  645. FUNCTION {unpublished}
  646. { output.bibitem
  647.   format.authors "author" output.check
  648.   author format.key output                % special for
  649.   output.year.check                    % apalike
  650.   new.block
  651.   format.title "title" output.check
  652.   new.block
  653.   note "note" output.check
  654.   fin.entry
  655. FUNCTION {default.type} { misc }
  656. MACRO {jan} {"January"}
  657. MACRO {feb} {"February"}
  658. MACRO {mar} {"March"}
  659. MACRO {apr} {"April"}
  660. MACRO {may} {"May"}
  661. MACRO {jun} {"June"}
  662. MACRO {jul} {"July"}
  663. MACRO {aug} {"August"}
  664. MACRO {sep} {"September"}
  665. MACRO {oct} {"October"}
  666. MACRO {nov} {"November"}
  667. MACRO {dec} {"December"}
  668. MACRO {acmcs} {"ACM Computing Surveys"}
  669. MACRO {acta} {"Acta Informatica"}
  670. MACRO {cacm} {"Communications of the ACM"}
  671. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  672. MACRO {ibmsj} {"IBM Systems Journal"}
  673. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  674. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  675. MACRO {ieeetcad}
  676.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  677. MACRO {ipl} {"Information Processing Letters"}
  678. MACRO {jacm} {"Journal of the ACM"}
  679. MACRO {jcss} {"Journal of Computer and System Sciences"}
  680. MACRO {scp} {"Science of Computer Programming"}
  681. MACRO {sicomp} {"SIAM Journal on Computing"}
  682. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  683. MACRO {tods} {"ACM Transactions on Database Systems"}
  684. MACRO {tog} {"ACM Transactions on Graphics"}
  685. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  686. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  687. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  688. MACRO {tcs} {"Theoretical Computer Science"}
  689. FUNCTION {sortify}
  690. { purify$
  691.   "l" change.case$
  692. INTEGERS { len }
  693. FUNCTION {chop.word}
  694. { 's :=
  695.   'len :=
  696.   s #1 len substring$ =
  697.     { s len #1 + global.max$ substring$ }
  698.     's
  699.   if$
  700. %            There are three apalike cases: one person (Jones),
  701. %            two (Jones and de~Bruijn), and more (Jones et~al.).
  702. %            This function is much like format.crossref.editors.
  703. FUNCTION {format.lab.names}
  704. { 's :=
  705.   s #1 "{vv~}{ll}" format.name$
  706.   s num.names$ duplicate$
  707.   #2 >
  708.     { pop$ " et~al." * }
  709.     { #2 <
  710.     'skip$
  711.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  712.         { " et~al." * }
  713.         { " and " * s #2 "{vv~}{ll}" format.name$ * }
  714.       if$
  715.       if$
  716.     }
  717.   if$
  718. FUNCTION {author.key.label}
  719. { author empty$
  720.     { key empty$
  721.     { cite$ #1 #3 substring$ }
  722.     'key                    % apalike uses the whole key
  723.       if$
  724.     }
  725.     { author format.lab.names }
  726.   if$
  727. FUNCTION {author.editor.key.label}
  728. { author empty$
  729.     { editor empty$
  730.     { key empty$
  731.         { cite$ #1 #3 substring$ }
  732.         'key                % apalike uses the whole key
  733.       if$
  734.     { editor format.lab.names }
  735.       if$
  736.     }
  737.     { author format.lab.names }
  738.   if$
  739. FUNCTION {editor.key.label}
  740. { editor empty$
  741.     { key empty$
  742.     { cite$ #1 #3 substring$ }
  743.     'key            % apalike uses the whole key, no organization
  744.       if$
  745.     }
  746.     { editor format.lab.names }
  747.   if$
  748. FUNCTION {calc.label}      % this function came from ASTRON.BST (ARR)
  749. { type$ "book" =
  750.   type$ "inbook" =
  751.     'author.editor.key.label
  752.     { type$ "proceedings" =
  753.         'editor.key.label                       % apalike ignores organization
  754.         'author.key.label                       % for labeling and sorting
  755.       if$
  756.     }
  757.   if$
  758.   "\protect\astroncite{" swap$ * "}{"                   % these three lines are
  759.   *                                                     % for apalike, which
  760.   year field.or.null purify$ #-1 #4 substring$          % uses all four digits
  761.   *                       % the mathing closing "}" comes in at the reverse.pass
  762.   'label :=
  763. FUNCTION {sort.format.names}
  764. { 's :=
  765.   #1 'nameptr :=
  766.   s num.names$ 'numnames :=
  767.   numnames 'namesleft :=
  768.     { namesleft #0 > }
  769.     { nameptr #1 >
  770.     { "   " * }
  771.     'skip$
  772.       if$                        % apalike uses initials
  773.       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't := % <= here
  774.       nameptr numnames = t "others" = and
  775.     { "et al" * }
  776.     { t sortify * }
  777.       if$
  778.       nameptr #1 + 'nameptr :=
  779.       namesleft #1 - 'namesleft :=
  780.     }
  781.   while$
  782. FUNCTION {sort.format.title}
  783. { 't :=
  784.   "A " #2
  785.     "An " #3
  786.       "The " #4 t chop.word
  787.     chop.word
  788.   chop.word
  789.   sortify
  790.   #1 global.max$ substring$
  791. FUNCTION {author.sort}
  792. { author empty$
  793.     { key empty$
  794.     { "to sort, need author or key in " cite$ * warning$
  795.       ""
  796.     { key sortify }
  797.       if$
  798.     }
  799.     { author sort.format.names }
  800.   if$
  801. FUNCTION {author.editor.sort}
  802. { author empty$
  803.     { editor empty$
  804.     { key empty$
  805.         { "to sort, need author, editor, or key in " cite$ * warning$
  806.           ""
  807.         }
  808.         { key sortify }
  809.       if$
  810.     { editor sort.format.names }
  811.       if$
  812.     }
  813.     { author sort.format.names }
  814.   if$
  815. FUNCTION {editor.sort}
  816. { editor empty$
  817.     { key empty$
  818.     { "to sort, need editor or key in " cite$ * warning$
  819.       ""
  820.     { key sortify }
  821.       if$
  822.     }
  823.     { editor sort.format.names }
  824.   if$
  825. %            apalike uses two sorting passes; the first one sets the
  826. %            labels so that the `a's, `b's, etc. can be computed;
  827. %            the second pass puts the references in "correct" order.
  828. %            The presort function is for the first pass. It computes
  829. %            label, sort.label, and title, and then concatenates.
  830. FUNCTION {presort}
  831. { calc.label
  832.   label sortify
  833.   "    "
  834.   type$ "book" =
  835.   type$ "inbook" =
  836.     'author.editor.sort
  837.     { type$ "proceedings" =
  838.     'editor.sort
  839.     'author.sort
  840.       if$
  841.     }
  842.   if$
  843.   #1 entry.max$ substring$    % for
  844.   'sort.label :=        % apalike
  845.   sort.label            % style
  846.   "    "
  847.   title field.or.null
  848.   sort.format.title
  849.   #1 entry.max$ substring$
  850.   'sort.key$ :=
  851. ITERATE {presort}
  852. SORT        % by label, sort.label, title---for final label calculation
  853. STRINGS { last.label next.extra }    % apalike labels are only for the text;
  854. INTEGERS { last.extra.num }        % there are none in the bibliography
  855. FUNCTION {initialize.extra.label.stuff}    % and hence there is no `longest.label'
  856. { #0 int.to.chr$ 'last.label :=
  857.   "" 'next.extra :=
  858.   #0 'last.extra.num :=
  859. FUNCTION {forward.pass}
  860. { last.label label =
  861.     { last.extra.num #1 + 'last.extra.num :=
  862.       last.extra.num int.to.chr$ 'extra.label :=
  863.     }
  864.     { "a" chr.to.int$ 'last.extra.num :=
  865.       "" 'extra.label :=
  866.       label 'last.label :=
  867.     }
  868.   if$
  869. FUNCTION {reverse.pass}       % this function came from ASTRON.BST (ARR)
  870. { next.extra "b" =
  871.     { "a" 'extra.label := }
  872.     'skip$
  873.   if$
  874.   label extra.label * "}" * 'label :=
  875.   extra.label 'next.extra :=
  876. EXECUTE {initialize.extra.label.stuff}
  877. ITERATE {forward.pass}
  878. REVERSE {reverse.pass}
  879. %                Now that the label is right we sort for real,
  880. %                on sort.label then year then title.  This is
  881. %                for the second sorting pass.
  882. FUNCTION {bib.sort.order}
  883. { sort.label
  884.   "    "
  885.   year field.or.null sortify
  886.   "    "
  887.   title field.or.null
  888.   sort.format.title
  889.   #1 entry.max$ substring$
  890.   'sort.key$ :=
  891. ITERATE {bib.sort.order}
  892. SORT        % by sort.label, year, title---giving final bibliography order
  893. FUNCTION {begin.bib}
  894. { preamble$ empty$                % no \etalchar in apalike
  895.     'skip$
  896.     { preamble$ write$ newline$ }
  897.   if$
  898.   "\begin{thebibliography}{}" write$ newline$        % no labels in apalike
  899. EXECUTE {begin.bib}
  900. EXECUTE {init.state.consts}
  901. ITERATE {call.type$}
  902. FUNCTION {end.bib}
  903. { newline$
  904.   "\end{thebibliography}" write$ newline$
  905. EXECUTE {end.bib}
  906.